home *** CD-ROM | disk | FTP | other *** search
-
-
-
- qqqquuuuoooottttaaaassss((((4444)))) qqqquuuuoooottttaaaassss((((4444))))
-
-
-
- NNNNAAAAMMMMEEEE
- quotas - filesystem quota subsystem
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- In most computing environments, disk space is not infinite. The
- lbootable qqqquuuuoooottttaaaassss subsystem provides a mechanism to control usage of disk
- space. Quotas can be set for each individual user on any or all of the
- local filesystems. The quotas subsystem warns users when they exceed
- their allotted limit, but allows some extra space for current work (hard
- limit/soft limit). In addition, XFS filesystems with limit enforcement
- turned off can be used as an effective disk usage accounting system.
-
- UUUUsssseeeerrrrssss'''' VVVViiiieeeewwwwssss ooooffff DDDDiiiisssskkkk QQQQuuuuoooottttaaaassss
- To most users, disk quotas are either of no concern or a fact of life
- that cannot be avoided. There are two possible quotas that can be
- imposed; usually if one is imposed, both are. A limit can be set on the
- amount of space a user can occupy, and there may be a limit on the number
- of files (inodes) he can own.
-
- The _q_u_o_t_a(1) command provides information on the quotas that have been
- set by the system administrators and current usage.
-
- There are four numbers for each limit: current usage, soft limit
- (quota), hard limit, and time limit. The soft limit is the number of 1K
- blocks (or files) that the user is expected to remain below. The hard
- limit cannot be exceeded. If a user's usage reaches the hard limit,
- further requests for space (or attempts to create a file) fail with an
- EDQUOT/ENOSPC error.
-
- When a user exceeds the soft limit, the timer is enabled. Any time the
- quota drops below the soft limits, the timer is disabled. If the timer
- pops, the particular limit that has been exceeded is treated as if the
- hard limit has been reached, and no more resources are allocated to the
- user. The oooonnnnllllyyyy way to reset this condition, short of turning off limit
- enforcement or increasing the limit, is to reduce usage below quota.
- Only the superuser can set the time limits and this is done on a per
- filesystem basis.
-
- SSSSuuuurrrrvvvviiiivvvviiiinnnngggg WWWWhhhheeeennnn tttthhhheeee QQQQuuuuoooottttaaaa LLLLiiiimmmmiiiitttt IIIIssss RRRReeeeaaaacccchhhheeeedddd
- In most cases, the only way for a user to recover from over-quota
- conditions is to abort whatever activity is in progress on the filesystem
- that has reached its limit, remove sufficient files to bring the limit
- back below quota, and retry the failed program.
-
- However, if a user is in the editor and a write fails because of an over
- quota situation, that is not a suitable course of action. It is most
- likely that initially attempting to write the file has truncated its
- previous contents, so if the editor is aborted without correctly writing
- the file, not only are the recent changes lost, but possibly much, or
- even all, of the contents that previously existed.
-
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- qqqquuuuoooottttaaaassss((((4444)))) qqqquuuuoooottttaaaassss((((4444))))
-
-
-
- There are several possible safe exits for a user caught in this
- situation. He can use the editor !!!! shell escape command to examine his
- file space and remove surplus files. Alternatively, using _c_s_h(1), he can
- suspend the editor, remove some files, then resume it. A third
- possibility is to write the file to some other filesystem (perhaps to a
- file on /_t_m_p) where the user's quota has not been exceeded. Then after
- rectifying the quota situation, the file can be moved back to the
- filesystem it belongs on.
-
- AAAAddddmmmmiiiinnnniiiisssstttteeeerrrriiiinnnngggg tttthhhheeee QQQQuuuuoooottttaaaa SSSSyyyysssstttteeeemmmm
- QQQQuuuuoooottttaaaassss is an lbootable subsystem that can be installed by the
- administrator. A decision as to what filesystems need to have quotas
- enabled needs to be made. Usually, only filesystems that house users'
- home directories or other user files need to be subjected to the quota
- system. If possible, /_t_m_p should be free of quotas.
-
- XFS and EFS quota systems share many characteristics. However, overall
- XFS offers a richer set of functionalities. We will explain the old EFS
- quota system first and differences in XFS afterwards.
-
- AAAAddddmmmmiiiinnnniiiisssstttteeeerrrriiiinnnngggg tttthhhheeee EEEEFFFFSSSS QQQQuuuuoooottttaaaa SSSSyyyysssstttteeeemmmm
- On EFS filesystems, a file by the name of _q_u_o_t_a_s should be created in the
- root of the filesystems that are to have quotas. This file should be of
- size zero and should be writable only by root. After deciding on the
- filesystems that will have quotas, the administrator then establishes
- quotas for individual users. The _e_d_q_u_o_t_a(1M) command is used to actually
- set the limits desired upon each user. Where a number of users are to be
- given the same quotas (a common occurrence) the ----pppp option to _e_d_q_u_o_t_a
- allows this to be easily accomplished. Unless explicitly given a quota,
- users have no limits set on the amount of disk they can use or the number
- of files they can create.
-
- Once the quotas are set and ready to operate, the system must be informed
- to enforce quotas on the desired filesystems. This is accomplished with
- the _q_u_o_t_a_o_n(1M) command. For quotas to be accurate, it should be enabled
- on a local filesystem immediately after the filesystem has been mounted.
- _q_u_o_t_a_o_n either enables quotas for a particular filesystem or, with the ----aaaa
- option, enables quotas for each filesystem indicated in /_e_t_c/_f_s_t_a_b as
- using quotas. See _f_s_t_a_b(4) for details. When the quotas subsystem is
- installed,
-
- /usr/etc/quotaon -a
-
- can be automatically executed during system boot up time by /_e_t_c/_r_c_2.
- The script /_e_t_c/_i_n_i_t._d/_q_u_o_t_a_s handles enabling of quotas and it uses the
- _c_h_k_c_o_n_f_i_g(1M) command to check the qqqquuuuoooottttaaaassss configuration flag to decide
- whether or not to enable quotas. Users can circumvent the quotas
- mechanism by giving the files away to other users with the use of
- _c_h_o_w_n(1) or _c_h_o_w_n(2). The system administrator can prevent this by
- setting the variable _r_e_s_t_r_i_c_t_e_d__c_h_o_w_n to a non-zero value (see _i_n_t_r_o(2)
- and _l_b_o_o_t(1M)).
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- qqqquuuuoooottttaaaassss((((4444)))) qqqquuuuoooottttaaaassss((((4444))))
-
-
-
- When quotas need to be disabled, the _q_u_o_t_a_o_f_f(1M) command is used.
- However, if the filesystem is about to be dismounted, the _u_m_o_u_n_t(1M)
- command disables quotas immediately before the filesystem is unmounted.
- This is actually an effect of the _u_m_o_u_n_t(2) system call, and it
- guarantees that the quota system is not disabled if the _u_m_o_u_n_t would fail
- because the filesystem is not idle.
-
- Periodically (certainly after each reboot and when quotas are first
- enabled for a filesystem), the records retained in the quota file should
- be checked for consistency with the actual number of blocks and files
- allocated to the user. The _q_u_o_t_a_c_h_e_c_k(1M) command is used to accomplish
- this. It is not necessary to dismount the filesystem or disable the
- quota system to run this command, though on active filesystems inaccurate
- results may occur. This does no real harm in most cases; another run of
- _q_u_o_t_a_c_h_e_c_k when the filesystem is idle corrects any inaccuracy.
- _q_u_o_t_a_c_h_e_c_k can be run automatically during boot up via the script
- /_e_t_c/_i_n_i_t._d/_q_u_o_t_a_s. Since _q_u_o_t_a_c_h_e_c_k can take some time, there is a
- _c_h_k_c_o_n_f_i_g flag called qqqquuuuoooottttaaaacccchhhheeeecccckkkk that controls whether or not to run
- _q_u_o_t_a_c_h_e_c_k at system boot up time.
-
- The superuser can use the _q_u_o_t_a command to examine the usage and quotas
- of any user, and the _r_e_p_q_u_o_t_a(1M) command can be used to check the usages
- and limits for all users on a filesystem.
-
- AAAAddddmmmmiiiinnnniiiisssstttteeeerrrriiiinnnngggg tttthhhheeee XXXXFFFFSSSS QQQQuuuuoooottttaaaa SSSSyyyysssstttteeeemmmm
- The XFS quota system is different from that of EFS in many ways.
-
- oooo There is no necessity for a _q_u_o_t_a_s file in the root of the XFS
- filesystem.
-
- oooo XFS distinguishes between quota accounting and limit enforcement.
- Quota accounting must be turned on at the time of mounting the XFS
- filesystem. However, it is possible to turn on/off limit
- enforcement any time quota accounting is turned on. The qqqquuuuoooottttaaaa option
- in _f_s_t_a_b(4) (or ----oooo qqqquuuuoooottttaaaa in _m_o_u_n_t(1M) ) turns on both quota
- accounting and enforcement. The qqqqnnnnooooeeeennnnffffoooorrrrcccceeee option must be used to
- turn on accounting with limit enforcement disabled. _q_u_o_t_a_o_n(1M)
- contains some examples of frequently used procedures.
-
- oooo Turning on quotas on the root filesystem is slightly different from
- the above. _q_u_o_t_a_o_n(1M) must be used on the root XFS filesystem
- first; quotas will be turned on the next time the system is
- rebooted. It is useful to use _r_e_p_q_u_o_t_a(1M) with the ----ssss option to
- monitor the effect of _q_u_o_t_a_o_n/_o_f_f at various stages.
-
- oooo _q_u_o_t_a_c_h_e_c_k(1M) has no effect on XFS filesystems. The first time
- quota accounting is turned on, XFS does an automatic quotacheck
- internally; afterwards, the quota system will always be completely
- consistent until quotas are manually turned off. Similarly,
- /_e_t_c/_c_h_k_c_o_n_f_i_g(1M) options qqqquuuuoooottttaaaassss and qqqquuuuoooottttaaaacccchhhheeeecccckkkk are not needed for
- XFS filesystems.
-
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-
-
-
- qqqquuuuoooottttaaaassss((((4444)))) qqqquuuuoooottttaaaassss((((4444))))
-
-
-
- oooo _r_e_p_q_u_o_t_a(1M) with the ----ssss option can be used to monitor the status of
- the quota system of an XFS filesystem. This can be used to see if
- quotas are turned on, given an XFS filesystem. It can also be used
- to monitor the space occupied by the quota system itself.
-
- oooo _r_e_p_q_u_o_t_a also provides a ----eeee option to output the limits of all users
- listed in /_e_t_c/_p_a_s_s_w_d to a file that can later be read in by
- _e_d_q_u_o_t_a(1M). This is useful in recreating the limits of a large
- number of users. A possible scenario would be ((((aaaa)))) creating the
- output file using _r_e_p_q_u_o_t_a, ((((bbbb)))) turning off quotas and deleting all
- the quota information (including limits, etc), ((((cccc)))) mounting the XFS
- filesystem back with quotas turned on, and ((((dddd)))) reading that file
- containing limits of users using _e_d_q_u_o_t_a. This procedure will help
- compact the quota information. Keeping all the limits saved in a
- file for later use will also help in case of a disaster because
- quota information cannot be backed up using _x_f_s_d_u_m_p(1M) or any other
- backup utility.
-
- oooo _e_d_q_u_o_t_a(1M) cannot be used to set quota limits before turning on
- quotas on the filesystem concerned.
-
- oooo XFS filesystems keep quota accounting on the superuser, and _q_u_o_t_a ----vvvv
- will display the superuser's usage information. However, limits are
- never enforced on the superuser.
-
- oooo XFS filesystems keep quota accounting whether the user has quota
- limits or not.
-
- QQQQuuuuoooottttaaaa IIIImmmmpppplllleeeemmmmeeeennnnttttaaaattttiiiioooonnnn NNNNooootttteeeessss
- On EFS filesystems, disk quota usage information is stored in a file on
- the filesystem that the quotas are to be applied to. Conventionally,
- this file is called _q_u_o_t_a_s, and resides at the root of the filesystem.
- While this name is not known to the system in any way, several of the
- user level utilities "know" it, and choosing any other name is not wise.
-
- The data in the quotas file is stored in a format different from
- Berkeley's implementation. Any direct accesses to the file by programs
- is not recommended. Instead, use the commands or the _q_u_o_t_a_c_t_l(2) system
- call to access or modify the quota information.
-
- The system is informed of the existence of the quota file by the _q_u_o_t_a_c_t_l
- system call. It then reads the quota entries for any open files owned by
- users. Each subsequent open of a file in the filesystem is accompanied
- by a pairing with its quota information. In memory, the quota
- information is kept hashed by user ID and filesystem and retained in an
- LRU chain so recently released data can be easily reclaimed.
-
- Each time a block is accessed or released and each time an inode is
- allocated or freed, the quota system gets told about it and, in the case
- of allocations, gets the opportunity to deny the allocation.
-
-
-
-
-
- PPPPaaaaggggeeee 4444
-
-
-
-
-
-
- qqqquuuuoooottttaaaassss((((4444)))) qqqquuuuoooottttaaaassss((((4444))))
-
-
-
- Note that the XFS quota system implementation is radically different from
- that of EFS described above. XFS considers quota information as
- filesystem metadata and uses journalling to provide a higher level
- guarantee of consistency. Among other things, it is worth mentioning
- that XFS can keep accounting information for a very large number of
- active users efficiently.
-
- BBBBUUUUGGGGSSSS
- Currently, it is not possible to enable quotas on XFS realtime
- filesystems.
-
- FFFFIIIILLLLEEEESSSS
- /etc/init.d/quotas script to enable and disable quotas
- /etc/rc2.d/S14quotas linked to /_e_t_c/_i_n_i_t._d/_q_u_o_t_a_s
- /etc/config/quotas _c_h_k_c_o_n_f_i_g flag
- /etc/config/quotacheck _c_h_k_c_o_n_f_i_g flag
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- mount(1M), chkconfig(1M), edquota(1M), quota(1), quotacheck(1M), rc2(1M),
- repquota(1M), quotactl(2), fstab(4).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 5555
-
-
-
-